<template>
  <view>
    <!-- 轮播图组件 -->
    <swiper :indicator-dots="true" circular :autoplay="true" class="advertising">
          <swiper-item v-for="item in homebannerList" :key="item.id">
           <navigator
           >
              <image
              :src="item.imgUrl"
              mode="scaleToFill"
              />
           </navigator>
          </swiper-item>
      </swiper>
  </view>
</template>

<script>
export default {
  data() {
    return {
      homebannerList:[]
    }
  },
  created(){
    this.getHomebanner()
  },
  methods:{
    // /home/banner
  async  getHomebanner(){
     const res = await uni.$u.http.request({
      url:'/home/banner'
     })
     this.homebannerList  = res.data.result
     console.log(this.homebannerList);
    }
  }
}
</script>

<style lang="scss">
// 广告区域
.advertising {
  box-sizing: border-box;
  padding: 10px;
  width: 100%;
  height: 140px;
  navigator {
    width: 100%;
    height: 140px;
    image {
      width: 100%;
      height: 140px;
    }
  }
}
</style>